namespace Wilco.CodeHilighter.Engine.SyntaxHighlighting
{
    using System;
    using System.Collections.ObjectModel;

    /// <summary>
    /// Represents a collection of scanners.
    /// </summary>
    public class ScannerCollection : Collection<IScanner>
    {
        #region Constructors

        /// <summary>
        /// Initializes a new instance of a <see cref="Wilco.CodeHilighter.Engine.SyntaxHighlighting.ScannerCollection"/> class.
        /// </summary>
        public ScannerCollection()
        {
            //
        }

        #endregion Constructors

        #region Indexers

        /// <summary>
        /// Gets an <see cref="Wilco.CodeHilighter.Engine.SyntaxHighlighting.IScanner"/> object at the specified index.
        /// </summary>
        public IScanner this[string id]
        {
            get
            {
                for (int i = 0; i < this.Count; i++)
                    if (this[i].ID == id)
                        return this[i];
                return null;
            }
        }

        #endregion Indexers
    }
}